<!DOCTYPE html>
<html>
    <head>
        <script src="js/vue.js"></script>
        <script src="js/vuex.js"></script>
    </head>
    <body>
        <div id="app">
            <!-- <p>{{this.$store.state.id}}</p> -->
            <p>{{id}}</p>
            <p>{{name}}</p>
        </div>
        <script>
            var store = new Vuex.Store({
                state : {
                    name : 'vuex.js直接引用',
                    id : 'id666'
                }
            })

            var mapState = Vuex.mapState;

            var vm = new Vue({
                el:'#app',
                store : store,
                computed : mapState({
                    name : state => state.name,
                    id : state => state.id
                })
                // computed : {
                //     name() {
                //         return this.$store.state.name;
                //     },
                //     id() {
                //         return this.$store.state.id;
                //     }
                // }
            })

        </script>
    </body>
</html>